//统一管理接口
import qs from "qs";

import request from "@/request/request.js";

//请求精品推荐数据
export const JingPinAPI = () => request.get("/products/recommend");

//发送短信验证码请求 {phone:134.....}
export const SendSMSAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));

//手机号验证码登录
export const PhoneReginAPI = (params) =>
  request.post("/phoneRegin", qs.stringify(params));

// console.log(
//   "qs.stringify:",
//   qs.stringify({ phone: 13430885555, name: "zhangsan" })
// );

// 微信扫码登录
export const WeixinLoginAPI = (params) =>
  request.post("/wechatUsers/PCLogin", qs.stringify(params));

//   手机绑定微信  /wechatUsers/binding

export const BngdingAPI = (params) =>
  request.post("/wechatUsers/binding", qs.stringify(params));

//   获取用户信息/shop/userProfiles
export const UserProfilesAPI = () => request.get("/shop/userProfiles");

// /products/hot  热门兑换
export const RemenAPI = () => request.get("/products/hot");

// 获取商品详情  /products/{id}
export const GoodsDetailsAPI = (id) => request.get(`/products/${id}`);

// 加入购物车 CarsAddAPI   /shop/carts/add
export const CarsAddAPI = (params) =>
  request.post("/shop/carts/add", qs.stringify(params));

//   全部商品  /products  传递参数  对象的形式
export const ProductsAPI = (params) => request.get("/products", { params });

// 查看购物车  /shop/carts
export const CarsAPI = () => request.get("/shop/carts");
